#ifndef STACKEDWIDGETSHELL_H
#define STACKEDWIDGETSHELL_H

#include <QObject>
#include <QStackedWidget>
#include <QMap>

class StackedWidgetShell : public QObject
{
    Q_OBJECT
public:
    explicit StackedWidgetShell(QObject *parent = nullptr);

    void shell(QStackedWidget *widget);
    void add(const QString &name, QWidget *widget);
    void remove(const QString &name);
    bool contains(const QString &name);
    void showWidget(const QString &name);
    QString currentWidgetName();

private slots:
    void object_onDestoryed(QObject *object);

private:
    QStackedWidget *_stackedWidget;
    QMap<QString,QWidget*> _nameToWidget;
};

#endif // STACKEDWIDGETSHELL_H
